$(function () {

    var left = $('.left');
    var right = $('.right');
    var down = $('.bzdown');
    var up = $('.bzup');
    var bg = $('.bgDiv');
    var leftNav = $('.leftNav');
    var rightNav = $('.rightNav');
    var downNav = $('.downNav');
    var upNav = $('.upNav');

    showNav(left, leftNav, "left");
    showNav(right, rightNav, "right");
    showNav(up, upNav, "bzup");
    showNav(down, downNav, "bzdown");

    function showNav(btn, navDiv, direction) {
        btn.on('click', function () {
            bg.css({
                display: "block",
                transition: "opacity .5s"
            });
            if (direction == "right") {
                navDiv.css({
                    right: "0px",
                    transition: "right 0.5s"
                });
            } else if (direction == "left") {
                navDiv.css({
                    left: "0px",
                    transition: "left 0.5s"
                });
            } else if (direction == "bzup") {
                navDiv.css({
                    top: "0px",
                    transition: "top 0.5s"
                });
            } else if (direction == "bzdown") {
                navDiv.css({
                    bottom: "0px",
                    transition: "bottom 0.5s"
                });
            }


        });
    }

    bg.on('click', function () {
        hideNav();
    });

    function hideNav() {
        leftNav.css({
            left: "-60%",
            transition: "left .5s"
        });
        rightNav.css({
            right: "-50%",
            transition: "right .5s"
        });
        upNav.css({
            top: "-70%",
            transition: "top .5s"
        });
        downNav.css({
            bottom: "-50%",
            webkitTransition:"bottom .5s",
            oTransition:"bottom .5s",
            mozTransition:"bottom .5s",
            transition: "bottom .5s"
        });
        bg.css({
            display: "none",
            transition: "display 1s"
        });
    }
});
//function pushView () {
//    var pub = new Pushbutton('#pushbutton', {
//        data: [
//            //{text:'Live' },
//            {text:'Activity' },
//            {text:'Post'}
//        ],
//        // 点击回调 返回true 则不隐藏弹出框
//        onClick: function( e ) {
////         		alert(e.index);
//            if(e.index==0){
//                location.reload();
//            }
//            else if(e.index==1){  //跳转到直播
//                var type="<?php echo $_SESSION["gr_type"]; ?>";
//                var id="<?php echo $_SESSION["uid"]; ?>";
//                var urllianjie='/api/userinfo?action=get_userinfo&id='+<?php echo $_SESSION["uid"];?>;
//                if( type== 4 ){
//                    $.post(urllianjie,{ info_id:id }).success(function(data){
//                        data = JSON.parse(data);
////                            console.log(data.data.if_check);
////                            console.log(typeof (data.if_check));
//                        if(data.data.if_check != 0){
//                            self.location='/main/post';
//                        }else{
//                            alert("请您耐心等待审核通过,审核通过后才能继续操作！");
//                        }
//                    })
//                }
//                //self.location='/user/mylive';
//            }
//            else if(e.index==2){  //活动发布 gongkun
//                //self.location='/main/post';
//                self.location='/bbs/forum.php?mod=misc&action=nav&mobile=2';
//            }else{
//                //self.location='/bbs/forum.php?mod=misc&action=nav&mobile=2';
////           			self.location='/main/tips';
//            }
//
//            return true;
//        },
//        // maxHeight: 100,  // 默认显示的高度
//        isShow: true   // 默认是否显示
//    });
//}